define(function(){
	//文本框提示
	var StarLevel=function(){
		var $starLevelTarget=false;
		function startLevelChange(e){
			if($starLevelTarget!=false){
				var $starlevelBar=$starLevelTarget;
				var levelMax=parseInt($starlevelBar.attr('data-levelmax')) || 5;
				var barRect=$starlevelBar[0].getBoundingClientRect();
				var clickedLevel=Math.ceil(Math.ceil(levelMax*(e.pageX-barRect.left)/(barRect.right-barRect.left))*(100/levelMax));
				$starlevelBar.attr('data-innerwidth',clickedLevel);
			}
		}
		$('body').on('mousedown','[data-type="starLevel"]',function(e){
			var $starlevelBar=$(this);
			if($starlevelBar.attr('data-readonly')=='true'){
				return false;
			}
			$starLevelTarget=$starlevelBar;
			startLevelChange(e);
		});
		$('body').on('mousemove',function(e){
			startLevelChange(e);
		});
		$('body').on('mouseup',function(e){
			if($starLevelTarget!=false){
				$starLevelTarget=false;
			}
		});
		/*$('body').on('click','[data-type="starLevel"]',function(e){
			var $starlevelBar=$(this);
			if($starlevelBar.attr('data-readonly')=='true'){
				return false;
			}
			var levelMax=parseInt($starlevelBar.attr('data-levelmax')) || 5;
			var barRect=$starlevelBar[0].getBoundingClientRect();
			var clickedLevel=Math.ceil(Math.ceil(levelMax*(e.pageX-barRect.left)/(barRect.right-barRect.left))*(100/levelMax));
			$starlevelBar.attr('data-innerwidth',clickedLevel);
		});*/
	}
	return StarLevel;
})
